Popup refactoring