Implement MasterElection

Why not ```lock_guard``` here? Remnant of something?