rewrite protocol part