Add documentation and some tests