treetable: big refactor 2