Assignment 2 submission

This is the code that finally worked for me.