Fixed an error in the algorithm's pseudocode