added the correct functionality of the algorithm that counts the votes.