added var to for loops