prev_command instead of global_flags for more code reduction