jshint and code formatting fixes