fixed some jshint errors and minor improvements