Set mergesame=1 (see comment), changed to work with modified lib
Prettier implementation of RemoveDuplicates