Cleanup and fixed bugs

Reset cache before/after running test
Simplified transform
Fixed bug when cache did not exist