Done chapter 5 to excercise 6