Added JS-doc comments; adjusted coding style