Added logic to determine a winner