improve for loop