Added command line options and fixed bugs
Fixed bug