First pseudo-working leader election. To be polished and the stopping conditions should be fixed