added more comments + corrected delete goal logic