Fixed jshint issues

Fixed jshint issues:
* Missing semi colons;
* Creating global 'for' variable. Should be 'for (var a ...'.