Added Scotts code for intersecting lines