adding anagram logic