Adding exception handlers and defensive code