fixes for js v2

+ fixes typo in comment
+ fixed typo from variable
+ fixed code-style
+ optimized some if-statements
+ removed some unused/unneeded variables
+ removed / re-sort some comments