finished search and sort