Improved code and test
Updated documentation