first iteration of the code