Implements comments of @r-gaia-cs. Adds check for template header. Breaks up some more long lines.