refactoring done; anagrams search based on letters