Optimization with finishInitialization function at popupMenu.js