Fixed a bug where sometimes HAMMER wouldn't get cleaned up properly,
causing random test failures.
Added a bunch more tests.