modofied algo desceiption again