Added some comments to explain program