Refactor the notification process code