finished cs258 lab2 exercise 2