Refactored CLI infrastructure.