Rewrite environment