Finish problem set #5. Closes #39.