Top-down rewriting

Now rewriting replaces terms top-down  (not only first level)