General cleanup in segmentation-related code. Using consistent function and variable names. Change-Id: I2deb3fded8797453a2081836c9ce2e79ade06eb7