updated as per HW6