added function table2tree