comment algorithm