added documentation. fixed unit test