Added some tests and documentation