rewrite tree propagation logic