refactored sumTotalVotes function