Refactored code for different classes for different notification types