Integrated declareWinner() function