Isolate template code