Improved variable caching