Added code for exceptions