Rewrite object tree