Added code comments to be easier for other developers to understand it.