Completely moved pop up handling to the core.