More work on OO conversion. Popup is partially working again.