Implemented command line feature and fixed bugs.