Further separation of template parsing and expansion