Adding necessary code for HW2 P2