Implemented simple caching logic