Wrote comment with algorithms.