Added comment.
Move functions to end of script for better appearance.
Diagnostic for random test failure.
Provisionally changing SegmentStep to use the term "stage" since this seemed more familiar to people.
Leaving the internal class name and so on the same for now.