using binding for better performance

There were concerns about loss of performance with for loop instead of while/shift.  A binding instead of an affectation might help.