code review and jshint fixes