add tests and docs