Improved documentation and clean up