refactor plugin