updated documentation and improved tests