First draft of command line tool and debug mode