Replace plugin-specific code with action hook