popup util refactored + cleanup