Adding code for HW6 Q2