Backport voting

I've done some testing already, but because this is a large commit, it should be verified again before we merge it.