added user input and graceful error handling