switching to a command line parser, refactoring into a cli and a lib