Added CollapseDuplicate method