first attempt at hw2 problem 2