Added .jshintrc + big reformatting and code cleanup according to jshint checking.