Added caching functionality