implemented sorting of search results