clean up and improved documentation