code cleanup and fixes small unit test
some docs