Segmenting code