changes to template reading