Added the logic of displaying notifications.