updating the function to get the only child of a node
simplifying isLeaf function
renaming functions to a commont style