Exercise 2 from DFI 1