segregate template parsing from context