plugin system rewrite