Refactored Command class