Added comments for the steps of the algorithm