Added error-checking when the grade is not a valid number.