Added smart caching