rewrite local code