A really dirty version of a faster rewriter

- this is purely bottom-up.