rewrite to use new popup() function