Replace algorithm with loop.
Merge topic 'minor-cleanups' into next

b9662db Replace algorithm with loop.