Improved handling of caching.