added logic to sort urls for query based on scores