Updated delete logic