major sorting overhaul