comment on what this simple algorithm is doing?