refactored command line interaction