jshint advice applied, code cleanup