Added global exception handling