cli refactored