half-baked code for leave protocol