add var statements to for loops