Correctly link nodes together (imported from part 3)