Adding in some comments to the source to make it clearer what is happening.