More modifications, this time to exit if there is a problem.