Updated codes

updated codes for end of iteration 2