Massive refactoring of Anagram library to make code more concise and reduce for looping.