Factor out validation and error checking.