removed test main
fixed getStartingSegment not working properly