Adding code for HW6 Q5