Use distinct bags to make SetUnion more scalable

As per email on the mailing list.