Updated esception handling