tied file delete to working function