More work on leader election. Candidate code added.