refactored notifications and added tests