Refactored user input function to make use of case

statements more extensively.