add handling of exceptions