Finalized the tree checker code