My commented solution to Assignment 2