Extracted code for "Add new" popup in a separate js file