Changed add_node_to_file code