add tests and documentation