refactored anagrams