Added additional comments to the sample, to make it easier to follow.