Better handling of exceptions