voting function implemented