Rework the caching mechanism