Added error handling to some user inputs.