tidy up of template