Deduplicate names for generation, also added tests