figuring out exception handling code