Added comments to the code.