refactoring voting system