Added comments and stepped through in the debugger

Final code for submission.