Thorough error checking.