rewrite the protocol part