Refactor out arg parsing

Now we parse the command line args in a separate method to running the command.  This cleans things up a lot and helps testing.