proper reordering when inserting or moving nodes