Adding error checking to hw7