Prettied up problem 4.a-b.