Changed var declaration - added 'children' & 'prev' (and comments)

No change to anything other than declaration statements. Use of
variables in rest of plugin to be changed in subsequent commits.

Not sure why prev is not lined up; it is in my editor.