added hw3 part 2 code.