Refine search function
Modified sort test