handle_command refactor