* started working on second part of the algorithm