Better handlling of exceptions