function refundBet(address gambler) public {
        
        ActiveBet storage bet = activeBets[gambler];
        require (bet.amount != 0);

        
        require (block.number > bet.placeBlockNumber + BET_EXPIRATION_BLOCKS);

        
        uint256 rollModulo = getRollModulo(bet.gameId);
        uint256 rollUnder = getRollUnder(rollModulo, bet.mask);

        lockedInBets -= uint128(getDiceWinAmount(bet.amount, rollModulo, rollUnder));

        
        uint256 refundAmount = bet.amount;
        delete activeBets[gambler];

        
        sendFunds(gambler, refundAmount, refundAmount);
    }