Finishing problem 1 from homework 2.