first iteration code in