Corrected for loop types