Added comments.
Corrected variable name mistake.