provided code for hw2