Updated anagram method