Added more documentation and more tests