Some API fixes/cleanups.
Documented API.