rewrite network code