refactor delete function