Method to uniformly build the tree