Final revisions to code, now working

Working code for submission to assignment 2