Refactoring and cleanup classes of CLI client