Refactor to prepare for PluginsDirectoryManagerEventHandler