added more tests
added documentaion; small code improvements