Use explicit exports.
Consolidate error checking.