Refactoring distinct-consecutive