added the beginnings of the leader election code.