function [YNew,counter,residual] = IMPLICIT(y,h,tolerance) 
% 
% k1 = fixed_point(y,h);
% 
y_k = y;

error = 5;
counter = 0;

%% Explicit Predictor using Kutta's Method

% k1 = fun(y);
% k2 = fun(y + (1)*(h.* k1));
% k3 = fun(y + ((-3/5)*(h.* k1))+((4/5)*(h.* k2)));
% k4 = fun(y + ((-3677/4080)*(h.* k1))+((4457/4080)*(h.* k2))+((1/17)*(h.* k3)));
% k5 = fun(y + ((-957/5950)*(h.* k1))+((139611/47600)*(h.* k2))+((-70591/9520)*(h.* k3)))+((36/7)*(h.* k4));
% y_k = y + ((-61/96).*h.*k1)+((145/384).*h.*k2)+((1625/1152).*h.*k3)+((1/3).*h.*k4)+((-35/72).*h.*k5);

%% Implicit Corrector Step
counter = 0;
while error >= tolerance
    y_2 = y + ((3/4)*(h.*fun(((2/3).*y)+((1/3).*y_k))))+((1/4)*(h.*fun(y+ h.*fun(((2/3).*y)+((1/3).*y_k)))));
    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;
    
  