commands refactoring