Identified some errors in the algorithm and marked