error handling and xs to delete