Improve for loop