Refactor some of the plug-in init