rewritten plugin system