improved sorting of middle list