Completed first and second exercises for chapter 8