caching and cleanup