Expanded error handling