refactoring popup.html