localize size variable outside loop