Adds more exception handling