** Refactored dialog to plugin.js file