Segmentation and error checking