Added a backup tree function to rebuild the tree if program where to shut down unexpectedly.