Updated logic for handling push notifications.