Complete refactoring the plugin