Added some more comments to the code.