code for second iteration