updated delete_node method