Using sets instead of lazy distinct.