More tests, and code changes to make the tests pass.