function _collect(uint hid, address winner, bytes32 offchain) private {
                Market storage m = markets[hid]; 

                require(m.state == 2);
                require(now > m.disputeTime);

                
                uint marketComm = (m.matched[winner][m.outcome].payout * m.fee) / 100;
                uint networkComm = (marketComm * NETWORK_FEE) / 100;

                uint amt = m.matched[winner][m.outcome].payout;

                amt += m.open[winner][1].stake; 
                amt += m.open[winner][2].stake;

                require(amt - marketComm >= 0);
                require(marketComm - networkComm >= 0);

                
                m.totalOpenStake -= m.open[winner][1].stake;
                m.totalOpenStake -= m.open[winner][2].stake;
                m.totalMatchedStake -= m.matched[winner][1].stake;
                m.totalMatchedStake -= m.matched[winner][2].stake;

                
                m.open[winner][1].stake = 0; 
                m.open[winner][2].stake = 0;
                m.matched[winner][1].stake = 0; 
                m.matched[winner][2].stake = 0;
                m.matched[winner][m.outcome].payout = 0;

                winner.transfer(amt - marketComm);
                m.creator.transfer(marketComm - networkComm);
                root.transfer(networkComm);

                emit __collect(hid, offchain);
                emit __test__collect(networkComm, marketComm - networkComm, amt - marketComm);
        }