added code for HW3