Added caching logic