Better way to implement intersect_with.