Added exceptions, and try statements