error checking added to process_command()