rewrite all codes