Edited some of the algorithm section