function settleBetCommon(Bet storage bet, uint randomNumber) 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;
    
    uint diceWinAmount;
    uint _jackpotFee;
    (diceWinAmount, _jackpotFee) = getDiceWinAmount(amount, rollUnder);
    
    uint diceWin = 0;
    uint jackpotWin = 0;

    uint dice = randomNumber / 10;
    

    
    if (dice < rollUnder) {
      diceWin = diceWinAmount;
    }
      
    
    lockedInBets -= uint128(diceWinAmount);
    
    
    if (amount >= MIN_JACKPOT_BET) {
      
      
      
      
      
      if (randomNumber == 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 * 15 /100);
    }
    todaysRewardSize += amount * HOUSE_EDGE_PERCENT / 100 * 9 /100;
    
    sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 wei : diceWin + jackpotWin, diceWin, dice, rollUnder, amount);
  }