initial read_segment_data code