Refactored caching