finishing the exercises from Chapter 5