Master: code cleaned up + added a better segmentation using the centroid, although not used yet