Refactor build_notification