Added .jshintrc
Performance-related improvements
 - Replaced forEach's with for loops
 - Extracted some inner functions

Removed jshint global comments (in favour of .jshintrc)