function SnapshotAndDistributePot() public
    {
        require(honeyPotAmount > 0);
        require(gasleft() >= 1000000);
        require(nextPotDistributionTime <= block.timestamp);
        
        uint globalMoney = 1;
        uint i = 0;
        for(i = 0; i < topindex; ++i)
        {
            globalMoney += miners[indexes[i]].money;
        }
        
        estimatedSupply = globalMoney;
        
        uint remainingPot = honeyPotAmount;
        
        
        uint potFraction = honeyPotAmount / 5;
                
        honeyPotAmount -= potFraction;
        
        potFraction /= 10000;
        
        for(i = 0; i < topindex; ++i)
        {
            
            MinerData storage m = miners[indexes[i]];
            uint share = (m.money * 10000) / globalMoney;
            if(share > 0)
            {
                uint newPot = potFraction * share;
                
                if(newPot <= remainingPot)
                {
                    m.unclaimedPot += newPot;
                    m.lastPotShare = newPot;
                    remainingPot   -= newPot;
                }
            }
        }
        
        nextPotDistributionTime = block.timestamp + 86400;
        
        MinerData storage jakpotWinner = miners[msg.sender];
        jakpotWinner.unclaimedPot += jackPot;
        jackPot = 0;
    }