Refactor cmdline args

This depends on #25, so please look at that first.