Adding docs.
jsdoc blocks added to every file and tidied up.