Wrapped buffer-iteration in function.