Move election logic into ElectionContext.