added an option to toggle caching