Solutions for Assignment #2

Updated with comments to explain functionality