Popup refactoring
fix #160