refactored voting