Began writing segmentation code to get linear fit