Add notification handling and gracefully handle shutdowns