Cleanup and improved documentation