Updated Segment.io code