Reducing duplication in templates