My adaptation of Matt's cleanup of the delete_item() code.