Rename some variables and add some comments to try to be a bit more clear.