Added logic to send notifications at the appropriate times