Rewrite codes