Added some user input checking