refactor delete()