Refactored the notification display section

Should behave the same as before with a few less assignments to the tooltip variable and no duplicated HTML code.