switch to for loop