performance improvement in plugins.js