Now works. Need to add empty arrays for some nodes that are only destinations.