specs for command line tool and some refactoring