Collapsed into single executable with command line parameters and cleaned up some of the code