Synchronized with JS version and improved logic
Added unit tests for full coverage
Added API documentation generation into README.md
Documentation fixes
Updated documentation to generate properly