adding caching to templates