Hopefully lower code complexity of template_header