Improved sorting