Refactor cast vote