Adding Tree fold and flatten
- Adding fold along with flatten to help manipulate the Tree structure.