Added an implementation of the original algorithm to prove that the model is correct