Added some code comments to explain what some of the methods do.