basic leader election working with some minor bugs