Added more expection handling