Updated comments to better clarify what is happening in the code