Rewrite generator