Assignment 3 solution