improvements to templates