Implemented data structure helper functions and process_command function.