exercise 2 done on hw5.