Added template caching