function revealResult(uint token, bytes32 queryId) internal {

        SpinRec storage spin = spinsByQuery[queryId];

        require(spin.id != 0);

        spin.token = token;
        address player = addresses[spin.id];
        spinsByAddr[player].token = token;

        emit Reveal(token, player, spin.bet, queryId);

        uint prizeNumerator = 0;

        if (token == 444) {
            prizeNumerator = jackpotNumerator;
        } else if (token == 333 || token == 222 || token == 111) {
            prizeNumerator = winNumerator;
        } else if (token%10 == 4 || token/10%10 == 4 || token/100%10 == 4) {
            prizeNumerator = giftNumerator;
        }

        uint balance = address(this).balance;
        uint prize = 0;
        if (prizeNumerator > 0) {
            prize =  balance / 100 * prizeNumerator;
            if (player.send(prize)) {
                if (prizeNumerator == jackpotNumerator) {
                    emit Jackpot(token, player, now, prize, balance);
                } else if (prizeNumerator == winNumerator) {
                    emit Win(token, player, now, prize, balance);
                } else {
                    emit Gift(token, player, now, prize, balance);
                }
                owner.transfer(spin.bet / ownerDenominator);
            }
        }
    }