Writing patch voting function.