handling of all the exceptions I can think of for now.