More cleanup and documentation