Expanded error checking section.