Exercise 37 (at least most of it)