Adding better failure handling