function settleBetCommon(Bet storage bet, uint reveal, bytes32 entropyBlockHash) private {
      
      uint amount = bet.amount;
      
      uint rollUnder = bet.rollUnder;
      address gambler = bet.gambler;
      
      
      require (amount != 0, "Bet should be in an 'active' state");

      applyVIPLevel(gambler, amount);
      
      
      bet.amount = 0;
      
      
      
      
      
      bytes32 entropy = keccak256(abi.encodePacked(reveal, entropyBlockHash));
      
      
      uint modulo = 100;
      uint dice = uint(entropy) % modulo;
      
      uint diceWinAmount;
      uint _jackpotFee;
      (diceWinAmount, _jackpotFee) = getDiceWinAmount(amount, rollUnder);
      
      uint diceWin = 0;
      uint jackpotWin = 0;
      
      
      if (modulo <= MAX_MASK_MODULO) {
        
        if ((2 ** dice) & bet.mask != 0) {
          diceWin = diceWinAmount;
        }
        
        } else {
          
          if (dice < rollUnder) {
            diceWin = diceWinAmount;
          }
          
        }
        
        
        lockedInBets -= uint128(diceWinAmount);
        
        
        if (amount >= MIN_JACKPOT_BET) {
          
          
          
          
          
          if ((uint(entropy) / modulo) % JACKPOT_MODULO == 0) {
            jackpotWin = jackpotSize;
            jackpotSize = 0;
          }
        }
        
        
        if (jackpotWin > 0) {
          emit JackpotPayment(gambler, jackpotWin, dice, rollUnder, amount);
        }
        
        if(bet.inviter != address(0)){
          
          
          bet.inviter.transfer(amount * HOUSE_EDGE_PERCENT / 100 * 10 /100);
        }
        todaysRewardSize += amount * HOUSE_EDGE_PERCENT / 100 * 9 /100;
        
        sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 wei : diceWin + jackpotWin, diceWin, dice, rollUnder, amount);
      }