Change error checking to use message formulation