move ssegment creation into writer