Rewrite most of protocol section