Added checks for node1 and node2 in removeEdge