refactoring and simple console user interface