Added error checking and notification