Add better docs and small fixes and cleanups.