"Functionalized" parts of TemplateRegionParser. Added tests for #167 and #168