Seems like you could do this in the map() above instead of iterating through the nodes again