refactor delete method