added Segment handling to streams