Clean up and add jsdoc comments.