moved header template to a templating function