Rearranging error checking.