added given code for hw2
hw2