Added function to insert a node in the tree