Working with sort and search