Improve the test setup and cleanup.