got segmentLine function working