plugins refactor