refactoring renderTemplate