refactoring for notifications