Added a whole lot of jsdoc comments and documentation