simplified loop initialisation
removed 'size' variable