finished the voting logic with tests