Correct intersect algorithm