More idiomatic error checking.

This code scrubbing change tries generally to return from errors
early, favoring taller code over wider code patterns.