cleaned up code using jshint