added first for loop for iteration solve