refactored notifications out into prototype function