small refactor for plugins