using String.intern() to get a minor memory saving for js style strings
minor refactoring to reduce duplication in optimised Trie nodes