Coming up with leave function for the node,Code added, logically correct
but will have to check it now