Code review comments mainly tidying up code to avoid repetition.

Need a better, more appropriate name for AbstractSegmentAware
Performance improvements