function cashOut(uint index) public {
        require(0 <= index && index < purchases.length);
        require(purchases[index].addr == msg.sender);
        
        uint earnings;
        uint amount;
        uint tangles;
        
        (earnings, amount) = getEarnings(index);
        purchases[index].addr = address(0);
        require(earnings != 0 && amount != 0);
        netStakes = netStakes.sub(amount);
        
        tangles = earnings.mul(multiplier).div(divisor);
        CashOutEvent(index, msg.sender, earnings, tangles);
        NetStakesChange(netStakes);
        
        tokenContract.transfer(msg.sender, tangles);
        msg.sender.transfer(earnings);
        return;
    }