updated the cache mechanism in MainActivity