Kevin Shih’s exercise 4.2