Simplify DuplicateRemoval code.