Refactored into Commandline Application

Most of the variables are exposed as command line options.  Needs testing.