Optimizations on leader election.
Merge pull request #86 from EasonLiao/optimize_election

Optimizations on leader election.