Fixed election protocol and some more minimal changes.