Improved on sorting and selecting