Add command line parser, a couple more fixes.