added error checks to Challenge 1 Hard