Moving to immutable trees, all trees handling can now be done only through tx.
Cloned the values so we won't have aliasing issues.