Fixed to allow for n anagrams of each word instead of just pairs