finish exercise 8.5.1