Changed error checking according to King Sallee