Made segmentation of transforms a function, not part of the script.