fixed jshint issues and formatted code