Simpleified the dedupe method.