More cleanup and documentation.