add tests and more documentation