seperated leave protocol into a function