modified for HW6