added line segment intersecgtion code