Cleaning up the plugin code and upgrading the common javascripts