recovered CMD.java and did some refactoring for parser