refactoring cli interface