add initialization of state in each iteration