Need to fix some file IO stuff. Working on increasing robustness of calls
Added better argument handling at command line
Fixed the IO problems