added the cache mechanism