completion of HW3 part3