added error checking for node1 and node2.