Assignment2 solution 1st iteration