Better input checking

Added better input checking and error handling in the event of 'strange'
user input. Input, such as '10.d', would not be handled correctly, so
the program now deals with this gracefully.