Refactor pathogen hook