Updates to caching function