Added some error checking in userinput.