Ensure group is valid.
Extract run_command_in_group method.
Reorder methods.