Restoring 'serpentine' functionality. Might be faster to move it out of the loop, but at least it's functional this way.