Added comments to the code

Proper etiquette dictates that any code presented to others should have
comments added at vital intervals to aid the readers' understanding.
So that, I did some of that!