add command line interface (among many other changes)