Add command line interface and corresponding test
extra cleanups