Add tests and doc