Better failure catching logic