Moved join commands inside the leader election loop.