Documentation and code cleanup

Documentation of the latest changes, and some code cleanup/fixes. In
particular, removed input sanitization code, opting to assert and return
instead.