rewrite for setting protocol