changed template to paste only non-empty fields