Refactor template not to use scope.lookupvar