basic solution to HW2