Clean up tests

Second try. See the individual commits for what is being done.