Halfway refactor tbtree