Improve sort behavior