finished the voting functionality