finished part4 of HW6