Cleaned up the reference implementation a bit. Moved sanitize out of the
library, and to the yet-too-be-committed driver. Simplified adding via
less complicated abstraction.