function parts = mergenulls(parts)

for iPart = 1:length(parts)
    newparts = [];
    if parts(iPart).letter == '-'
        parts(iPart).indices = sort(parts(iPart).indices);
        newpartind = 0;
        indices = [-1 parts(iPart).indices];
        for iInd = 2:length(indices)
            if indices(iInd) - indices(iInd-1) > 1
                newpartind = newpartind + 1;
                newparts(newpartind).letter = ['n' num2str(newpartind)];
                newparts(newpartind).n = 1;
                newparts(newpartind).indices = indices(iInd);
                newparts(newpartind).level = 0;                
            else
                newparts(newpartind).n = newparts(newpartind).n + 1;
            end
        end
        parts(iPart) = [];
        parts = [parts  newparts];
    end
end

