Refactoring Command class