Some kind of duplication filtering working.

Not working properly though. Filtering takes place at the wrong place.