Changes to select leader

leader selection and reselection