finish delete function