Fixed the problem with invalid user input

Added global varialbes to fix declaration scope problem...
checks users input and returns an error message