Improved functionality and added documentation.