Re-implemented remove duplicates
Now using a more efficent approach using a tree.
Matching sets are no longer removed but merged.
Removed group list size limit