Intersection alg reimplemented