Take out parameter setting from the loop