renderTemplate method