reafactoring popover-message directive