update with variables and for loops