hw2: almost done.