cleaned up code for anagramic squares