Change code for returning highest scoring match to use generator to avoid overhead of sorting the list