Adding changes for Handling tree nodes