Added explaining comments to code