all new popup handling, not done in js anymore