rewrite generator