Added sorting of results based on match quality.