Some refactoring in the Plugin.cs