Modified treedb.c