Code cleanup and refactored TrieSet