Better documentation of SAI behavior.

Also rename some variables to clarify the code.