restructure by assignment, do assignment 2 using for loops
fix merge conflict