userInput function

Wrap frequently used code to handle user input