added code for cs520 prog7