implementing the deletion logic, now is at main thread