Enhanced chooseLeader algorithm