more error handling and recovoery logic.