better notification code structure