ExternalSort helper