Failure handling and general improvements.