added image and alg explaination