Added comments to explain code some