adding try except
adding try except
taking out extraneous def