Added and integrated with settings option to count adjacent errors as part of the same error

Refactored some ranges into xranges