tidy up of template copytemplate etc.