same TODO. I think this is solvabale pretty easily: replace (x ++ x) with x.flatMap { t => Set(t, t) }