organize a tree data