 for x= 1:100
     
    s = spikes;
    for i=1:107
    for j=1:length(s{i})
    s{i}(j) = s{i}(j) + (rand(1)-.5)/2;
    end
    end
    t = l>60000;
    tt = find(t)
    for i=1:length(tt)
    s{tt(i)}=[];
    end

    [tree_jitter, count,siz] = EventTree(s,.015,3,15);


    f = find(tree_jitter{end}>10);
    for i=1:length(f)
        cellseq(i,:) = sparse2mat(siz,f(i));
        idx(i) = f(i);
    end
    disp(['starting with ' num2str(length(f)) ' potential sequences..'])


    obs_jitter = zeros(length(idx),length(perms(cellseq(1,:))));

    for s = 1:length(idx)
       seq = cellseq(s,:);
       perm = perms(seq);
       for p=1:length(perm)
           ndx = mat2sparse(siz,perm(p,:));
           if ndx ~= idx(s)
    %        [ts] = findchain(spikes,perm(p,:),alpha,chainlimit);
              obs_jitter(s,p) = tree{end}(ndx);
           end
       end
       actual_jitter(s) = tree{end}(idx(s));
    end

    f = find(actual_jitter>100);
    ff = find((actual_jitter./sum([obs_jitter'; actual_jitter]))>.3);


    obs_jitter_iter{x} = obs_jitter;
    actual_jitter_iter{x} = actual_jitter;
    clear actual_jitter obs_jitter cellseq idx
    x
end
