fixed errors amir pointed out
HW3 Q2b,c