Revert "Revert "improve plugin architecture""