Duplicate detection tweaks (take 2)