Make mior changes to for loop