Ran the code through jshint and making some of the recommended changes