added deleting of nodes if there are no children