added some comments to the delete function