some polishing of templates