General refactoring and command add
General refactoring and command add