improved cache location implementation
Added comments
More tweaks to cache I/O operations.
Fixed failing tests.