Adding the renderTemplate function back