rebuild of tree implementation
simple change