HW 2 code