jshint changes and code cleanup