Refactor command structure