Fixes, API tweaks, docs, and cleanup.