Adding Error file handling