Refactored for arbitrary number of candidates