Refactor pathogen function call