My solution to the second assignment.