Replace private fn with pattern-matching case
Use pattern-matching case statements in toRangeAtomSequence