Reorganize hooks so as not to pollute the test environment