Add tests, documents and pre-conditions