tightened up logging, command line options, and error checking