Added documentation and more tests