Solution to assignment.