function [YNew,counter,residual] = IMPLICIT(y,h,tolerance,tt) 
% 
% k1 = fixed_point(y,h);
% 
% YNew = k1;
counter = 0;
error = 5;

%% Explicit Predictor using Heun's Method

k1 = fun(y,tt);
k2 = fun(y + (h.* k1),tt);
y_k = y + ((1/2).*h.*k1)+((1/2).*h.*k2);

%% Implicit Corrector Step
counter = 0;
while error >=tolerance
    y_2 = y + (h.*fun(y_k,tt));
    if counter == 0
        residual = norm(y_2-y_k);
    end
    error_vector = abs(y_2-y_k);
    error = norm(error_vector);
    counter = counter + 1;
    y_k = y_2;
end

YNew = y_2;
    
  