Issue #45: refactoring the notification logic