caching

code cleaned
more tests added
caching

fixed unit test