Traversal recognizes words now, as expected. Added a terminal flag to every node so that prefixes which are not words would not be outputted.