created caching function