Simplified Trie loops and commented complex ones.