Better error checking.