adding exercises 3 and 4 from chapter 1