Jshint and bug fixes