Documented the algorithm