function [Delays] = Macro_Conc_Decoder(u,n,p,k,M,T,Channel)
Shift = T*M;
Conc_Length = Shift;
Conc_Channel = [zeros(1,Conc_Length) Channel zeros(1,Conc_Length)];
%Decoded_Channel = Channel;

%Delays = [];
%Delays = [10*T zeros(1,length(Channel))];

Delays_1 = zeros(1,length(Conc_Channel));
Delays_2 = zeros(1,length(Conc_Channel));
%Delays_3 = zeros(1,length(Conc_Channel));

u_debt = zeros(1,length(Conc_Channel));
n_debt = zeros(1,length(Conc_Channel));
p_debt = zeros(1,length(Conc_Channel));
k_debt = zeros(1,length(Conc_Channel));
%u_debt(1:T) = 0; n_debt(1:T) = 0; p_debt(1:T) = 0;
%Recovered = 1;
for index = Conc_Length+1:length(Channel)+2*Conc_Length;
    if Conc_Channel(index) == 0;
        if sum(u_debt(1:index-1)) + sum(n_debt(1:index-1)) == 0; % No Erasures Yet
        	u_debt(index) = 0;
            n_debt(index) = 0;
            p_debt(index) = 0;
            k_debt(index) = 0;
        elseif sum(u_debt(1:index-Shift)) + sum(n_debt(1:index-1)) == 0; % No Erasures Yet
            u_debt(index) = 0;
            n_debt(index) = 0;
            p_debt(index) = 0;
            k_debt(index) = k;
        else
        	u_debt(index) = 0;
            n_debt(index) = 0;
            p_debt(index) = p;
            k_debt(index) = k;
        end
    else
        u_debt(index) = u;
        n_debt(index) = n;
        p_debt(index) = 0;
        k_debt(index) = 0;
    end 
    
    %{
    if sum(p_debt(1:index)) + sum(k_debt(1:index)) >= sum(u_debt(1:index-1)) && sum(n_debt(1:index-1)) == 0;
        Delay = index - find(u_debt(1:index-1));
        Delays_3(find(u_debt(1:index-1))) = Delay;
        n_debt(1:index-1) = 0;
        u_debt(1:index-1) = 0;
        p_debt(1:index) = 0;
        k_debt(1:index) = 0;
    end
    %}
    
    if sum(k_debt(1:index)) >= sum(u_debt(1:index-1));
        %Delay = index - find(u_debt(1:index-1));
        Delay = ceil(index/M) - ceil(find(u_debt(1:index-1))/M);
        Delays_1(find(u_debt(1:index-1))) = Delay;
        
        %n_debt(1:index-1) = 0;
        u_debt(1:index-1) = 0;
        %p_debt(1:index) = 0;
        k_debt(1:index) = 0;
    end
    
    if sum(p_debt(1:index)) >= sum(n_debt(1:index-1)) + sum(u_debt(1:index-Shift));
        %Delay = index - find(u_debt(1:index-Shift));
        Delay = ceil(index/M) - ceil(find(u_debt(1:index-Shift))/M);
        Delays_2(find(u_debt(1:index-Shift))) = Delay;
        %Delays_2(find(u_debt(1:index-Shift))) = min(Delay, Delays(find(u_debt(1:index-Shift))));
        
        n_debt(1:index-1) = 0;
        u_debt(1:index-Shift) = 0;
        p_debt(1:index) = 0;
        %k_debt(1:index) = 0;
    end
    
    
    %{
    disp(u_debt(index))
    disp(n_debt(index))
    disp(p_debt(index))
    disp(k_debt(index))
    disp(Delays_1)
    disp('=========')
    %}
end
%Delays = Delays(find(Delays));
%Delays = Delays(2:end);
Delays_1 = Delays_1(Conc_Length+1:end-Conc_Length);
Delays_2 = Delays_2(Conc_Length+1:end-Conc_Length);
%Delays_3 = Delays_3(Conc_Length+1:end-Conc_Length);
Delays = zeros(1,length(Delays_1));

preDelays_All = [Delays_1; Delays_2];
for ii = 1:length(Delays_1);
    preDelays = preDelays_All(:,ii);
    if isempty(find(preDelays));
        Delays(ii) = 0;
    else
        Delays(ii) = min(preDelays(find(preDelays)));
    end
end