Dociment some public APIs, and some cleanup.