use Lambda instead of manual iterating
little refactoring/doc completion