More cleanup and improved documentation