added jsdoc and some indentation