Final solution to Assignment 2