Added comments to clear up some of the code.