Added some additional comments to explain previous code.