Improve/institute a tree preservation and replacement code.

Updates