Semi-major refactoring and additions to plugin engine