Massive cleanup and refactor for docs.