Implemented leader election