function settleBet(uint _betId, uint data) external onlyBot {
        require(data != 0);
        Bet storage bet = bets[_betId];
        uint placeBlockNumber = bet.placeBlockNumber;

        require (block.number > placeBlockNumber);
        require (block.number <= placeBlockNumber + BET_EXPIRATION_BLOCKS);
        uint amount = bet.amount;
        address gambler = bet.gambler;

        require (amount != 0, "Bet should be in an 'active' state");

        bet.amount = 0;

        uint possibleWinAmount = getWinAmount(amount);
        uint winAmount = 0;
        uint seed = uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty)));
        uint random = data.add(seed);

        if(bet.option == BLACK) {
            winAmount = random % 2 == BLACK ? possibleWinAmount : 0;
        }

        if(bet.option == WHITE) {
            winAmount = random % 2 == WHITE ? possibleWinAmount : 0;
        }

        if(winAmount > 0) {
            require(address(this).balance >= minAmount + winAmount + teamBalance );
        }

        teamBalance = teamBalance.add(beneficiaryPercent(amount));
        lockedInBets -= possibleWinAmount;

        sendFunds(gambler, winAmount);

        emit Reveal(_betId, data, seed, winAmount, gambler, bet.option);
    }