Try to clarify a bit with comments and variable renaming.