added intersect code