refactor vote.js