Got rid of bugs and fixed jshint issues.