Collapse duplicates