Restructuring CLI code.