added process_wait and command-line options