function resolveChallenge(bytes32 _listingHash) private {
        uint challengeID = listings[_listingHash].challengeID;

        
        
        uint reward = determineReward(challengeID);

        
        challenges[challengeID].resolved = true;

        
        challenges[challengeID].totalTokens =
            voting.getTotalNumberOfTokensForWinningOption(challengeID);

        
        if (voting.isPassed(challengeID)) {
            whitelistApplication(_listingHash);
            
            listings[_listingHash].unstakedDeposit = listings[_listingHash].unstakedDeposit.add(reward);

            totalStaked[listings[_listingHash].owner] = totalStaked[listings[_listingHash].owner].add(reward);

            emit _ChallengeFailed(_listingHash, challengeID, challenges[challengeID].rewardPool, challenges[challengeID].totalTokens);
        }
        
        else {
            resetListing(_listingHash);
            
            require(token.transfer(challenges[challengeID].challenger, reward));

            emit _ChallengeSucceeded(_listingHash, challengeID, challenges[challengeID].rewardPool, challenges[challengeID].totalTokens);
        }
    }