Refactor Popup