Initial comments to the algorithm

Added some comments to teach the newbies (such as I) what the code is actually doing.