allocating memory at the segment level
fixed merge conflict