BHV-15361: Refactor Popup to work more reliably.