cleanup code, add shadow, remove unnecessary variables, fix Jshint errors,