Refactor delete()