Refactored externalSorter in own class