refactored commander