Refactored to simplify command structure.