addSegment() function now adds coordinates as integers