Added JSDoc comments.

Can now generate documentation with the jsdoc tool.
Refactor: Made variable name more explicit.