refactoring CLI