Add fine-tuned exception handling