add tests and doc