This could be done once outside the loop.