successfully added error checking.