Script updated to use generated nodeIDs