Sort out edits and add nodes