I think there is likely a performance benefit here as well. I will work on adding the tree array based approach (issue #312) in the future, but I think this code is fast enough for inclusion now. Not urgent for me though, so if you all disagree I will deal with that issue first.