Moved gathering of user input to the main method of the script.