Added jshint newcap and undef options and fixed warning