My last change got most of the tests to pass. This file also needs tweaking. Here's my first attempt to do so.