start of CLI refactoring