Refactored popup and background