added error checking 2