Add documentation and more test coverage