improved search and sorting