Refactor node copying and moving