refactored command