Refactor popover class