Replaced deprecated Application.delete with Application.remove.