Half-assed solution to problem 2.