rewrote segments in mb_implemet