Improve matching and store sorted list of matched locations