Add tests and docs