Exercise 17 with a simplified version