update documentation and add tests