wrote remove_node function