Completion of the original form of the algorithm