Added error checking to 602 hmwk 3