Add tests, update documentation