improve readability of for loop