Rewrite trie construction and rendering, closes #3