Added some comments to the code.