refactored voting into a helper method