code for HW2