Catch ValueError in process_cmd.
Added helper function get_queue_length
is_index_in_queue takes queue_length parameter and always returns boolean.
added remove_index_from_queue