added sorting to the matched results