Implemented the voting function