Write tests
Add tests and doc