clean up caching code