trie's 'foreach' implementation corrected and improved; demo updated.