code for HW4