Made the js compliant to jshint's rules