Added more flexibility for templates