Refactor hooks. Update test that had slipped.