Modified action() to take take a copy of command rather than a pointer.