plugin refactoring