organize code in branch: segmentation