Added implementation for the constructor of class Tree
Refactored Some code