add basic implementation of command line interface
fixed bugs in CLI