Refactor plugin class